import React from 'react'
import { Navigate } from 'react-router-dom'
import { useSelectorAuth } from '@/store/slice/auth'
// 路由拦截
export const AuthComponent = (props: any) => {
    // 获取登录状态
    const auth = useSelectorAuth()
    // 判断是否登录
    return auth.token ? props.children : <Navigate to="/login" />
}
